package leetcode.interview;

public class TestOffer03 {
    public int findRepeatNumber(int[] nums) {
        int start=0;
        if(nums[0]==0)
            start=1;
        for(int i=start;i<nums.length;i++){
            int index=Math.abs(nums[i]);
            if(index==0 && start==1){
                return 0;
            }
            else if(nums[index]<0)
                return index;
            else {
                nums[index]*=-1;
            }
        }
        return -1;
    }
}
